﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
										xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
										xmlns:labs="clr-namespace:DaveSexton.Labs;assembly=DaveSexton.Labs">

	<Style TargetType="labs:OutOfBrowserContentControl">
		<Setter Property="Template">
			<Setter.Value>

				<ControlTemplate TargetType="labs:OutOfBrowserContentControl">

					<Grid Background="{TemplateBinding Background}">

						<Grid.Resources>
							<labs:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
							<labs:BooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible" />
							<labs:OutOfBrowserReasonToVisibilityConverter x:Key="ElevatedTrust" VisibleValue="ElevatedTrust" />
							<labs:OutOfBrowserReasonToVisibilityConverter x:Key="InternetAccess" VisibleValue="InternetAccess" />
							<labs:OutOfBrowserReasonToVisibilityConverter x:Key="FileSystemAccess" VisibleValue="FileSystemAccess" />
						</Grid.Resources>

						<StackPanel Visibility="{Binding IsRunningOutOfBrowser, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
												VerticalAlignment="Center" HorizontalAlignment="Center"
												Margin="10">

							<StackPanel.Resources>
								<Style TargetType="TextBlock">
									<Setter Property="TextWrapping" Value="Wrap" />
								</Style>
							</StackPanel.Resources>

							<TextBlock Visibility="{Binding Reason, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InternetAccess}}">
								This lab requires an out-of-browser installation to allow Internet access.
							</TextBlock>

							<TextBlock Visibility="{Binding Reason, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource FileSystemAccess}}">
								This lab requires an out-of-browser installation to allow file system access.
							</TextBlock>

							<TextBlock Visibility="{Binding Reason, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ElevatedTrust}}">
								This lab requires an out-of-browser installation for elevated trust.
							</TextBlock>

							<TextBlock>
									<LineBreak />
							</TextBlock>

							<TextBlock Visibility="{Binding IsInstalled, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBooleanToVisibilityConverter}}">

									Please right-mouse click here and select <Bold>Install <Run Text="{Binding ApplicationName, RelativeSource={RelativeSource TemplatedParent}, Mode=OneTime}" /> onto this computer</Bold>.
									Then try running this lab again when the installed application launches.

							</TextBlock>

							<TextBlock Visibility="{Binding IsInstalled, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}">

									It appears that you have already installed <Run Text="{Binding ApplicationName, RelativeSource={RelativeSource TemplatedParent}, Mode=OneTime}" /> onto this computer.
									Please locate the shortcut on your desktop or Start Menu and launch the application.
									Then try running this lab again.

							</TextBlock>

							<TextBlock>
									
									<LineBreak />
									<LineBreak />
									
									You can uninstall this application at any time.
									Simply launch the application, right-mouse click and select
									<Bold>Remove this application.</Bold>
									
									<LineBreak />
									<LineBreak />
									
									<Italic>More Information:</Italic>

							</TextBlock>

							<TextBox Text="http://msdn.microsoft.com/en-us/library/dd550721(v=vs.95).aspx"
												IsReadOnly="True" FontStyle="Italic" BorderThickness="0" />

						</StackPanel>

						<ContentPresenter Visibility="{Binding IsRunningOutOfBrowser, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />

					</Grid>

				</ControlTemplate>

			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>